package lab8;

public class Student implements Comparable<Student> {
	private int sid;
	private String name;

	public Student(int sid, String name) {
		this.sid = sid;
		this.name = name;
	}

	public int getSid() {
		return sid;
	}

	public void setSid(int sid) {
		this.sid = sid;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Override
	public int compareTo(Student o) {
		return this.name.compareTo(o.getName());
	}
	
	@Override
	public String toString() {
		return sid + ":" + name;
	}
	
	// Use for JUnitTest (assertEqual)
	@Override
	public boolean equals(Object obj) {
		if (obj instanceof Student) {
			Student s = (Student) obj;
			return ((s.getSid() == this.sid) && (s.getName().compareTo(this.name) == 0));
		} else {
			return false;
		}
		
	}

}
